#include<iostream>
#include<string>

#include"nfa.h"

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
	NFA n;
	cin >> n;
	/*
	string s = "aaabab";
	//string s = "word";
	if (n . isAccepting(n . feedString(n . startingState(), s)))
		cout << "string accepted" << endl;
	else
		cout << "string rejected" << endl;*/
	//n += n;
	/*
	if (n . isAccepting(n . feedString(n . startingState(), s)))
		cout << "string accepted" << endl;
	else
		cout << "string rejected" << endl;
	/*unsigned to = NFA::names.addName("hoho");
	unsigned from = n . starting;
	n . renameStates(from, to);*/
	DFA d = n . determinate();
	cout << d;
	d = d.mimimize();
	cout << d;
	return 0;
}
